import request from "@/services/request";
const prefix = `${import.meta.env.VITE_API_PREFIX}`;

// 获取csrf
export function csrf() {
  return request({
    url: "/passport/csrf",
    method: "get",
  });
}

// 用户登陆
export function userLogin(data: any) {
  return request({
    url: "/passport/local",
    method: "post",
    data,
  });
}

// 退出登陆
export function userLogout() {
  return request({
    url: "/passport/logout",
    method: "get",
  });
}

// 获取验证码
export function getcode(params: any) {
  return request({
    url: "/passport/getcode",
    method: "get",
    params,
  });
}

// 获取perms
export function getPerms() {
  return request({
    url: `${prefix}/account/getperms`,
    method: "get",
  });
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: `${prefix}/admin/user`,
    method: "get",
  });
}

// 获取菜单
export function getUserMenu() {
  return request({
    url: `${prefix}/admin/menu`,
    method: "get",
  });
}
